package chat.client.gui;

import java.io.PrintStream;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

@SuppressWarnings("serial")
public class ClientTextPanel extends JPanel{
	
	public static JTextArea textField = new JTextArea(24,30);
	public static JScrollPane scrollPane;
		
	/**
	 * Konstruktor
	 */
	public ClientTextPanel() {
		
		setSize(getPreferredSize());
		
		textField.setEditable(false);
		textField.setVisible(true);
		
		scrollPane = new JScrollPane(textField);
		scrollPane.setSize(scrollPane.getPreferredSize());
		
		add(scrollPane);
		
		setVisible(true);
		
		PrintStream stream = new PrintStream(System.out);
		System.setOut(stream);		
		
	}
	
	/**
	 * schreibt String "s" in das TextArea "area"
	 * @param s
	 * @param area
	 */
	public static void print(String s, JTextArea area) {
        area.append(s + "\n");
    }
	
}
